package com.example.libretranslatemobile.settings;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.MenuItem;

import com.example.libretranslatemobile.FieldsAdapter;
import com.example.libretranslatemobile.R;

import java.util.ArrayList;
import java.util.Arrays;

public class SettingsActivity extends AppCompatActivity {

    RecyclerView recyclerView;
    SettingsAdapter settingsAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        setTitle("Settings");

        ActionBar actionBar =getSupportActionBar();
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);


        ArrayList<String> itemText = new ArrayList<String>();
        itemText.addAll(Arrays.asList("Connection","Color(coming soon)","Import&Export settings(coming soon)"));

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView = findViewById(R.id.settings_rv);
        recyclerView.setLayoutManager(layoutManager);

        recyclerView.setHasFixedSize(true);

        settingsAdapter = new SettingsAdapter(itemText.size(), itemText);
        recyclerView.setAdapter(settingsAdapter);


    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId() == android.R.id.home){
            this.finish();
            return true;
        }else{
            return super.onOptionsItemSelected(item);
        }
    }
}